<?php Yii::app()->clientScript->registerScript('info', "
    var jobid='$model->jobid';
    var custno='$model->custno';
    var locno='$model->locno';
    ", CClientScript::POS_HEAD); ?>
<?php //Yii::app()->clientScript->registerScript('jobid',"var jobid='$model->jobid';",CClientScript::POS_HEAD)?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/jobsdocuments.js', CClientScript::POS_BEGIN); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/jobupdate.js', CClientScript::POS_BEGIN); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/poupdate.js', CClientScript::POS_BEGIN); ?>
<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->baseUrl . '/js/app/jobsDispatch.js', CClientScript::POS_BEGIN); ?>
<div id="left-col">
    <?php
    
    $this->renderPartial('_side', array(
        'location' => $model->location,
        'customer' => $model->customer,
        'job' => $model,
        'action' => 'update'
    ));
    ?>    
</div>

<div id="right-col">

    <div class="wrap">
        <div class="container">


            <div id="breadcrumb" style="display:none;"><span style="padding-left:10px;font-size:10px;color:#777777;" id="alsoviewing"></span></div>
            <div class="inside">

<?php

$this->renderPartial('_view', array(
    'model' => $model,
    'customer' => $model->location->customer,
));
?>
                <div id="panel"></div>
                <ul id="tab" class="tabs tabs-with-summary">
                    <li class="active"><a id="tabNoteLink" href="#tabNote">Notes</a></li>
                    <li><a href="#tabDispatch">Dispatch</a></li>
                    <li><a href="#tabPo" >PO's</a></li>
                    <li class=""><a id="tabDocumentLink" href="#tabDocument">Documents</a></li>
                    <li><a href="#tabBilling" >Accounting </a></li>

                </ul>
                <div id="tab1"></div>
                <div id="tabPo">
                    <br/>
                    <a href="index.php?r=vendors/po/create&jobid=<?=$model->jobid?>" class="add-button">Add Purchase Order</a>
                    <br/>
                    <div id="customer-list"></div>
                </div>
                <div id="tabNote">
                    <br/>
                    <a href="javascript:void(0)" class="add-button" id="createNote">Add Note</a>

                    <div id="notes-list" class="">

                    </div>
                </div>
                <div id='tabBilling'>
                    <br/>
                    <script>
                     
                        $(document).ready(function(){
                            $('#createQuote').click(function(e){
                                var href=$(this).attr('href');
                                window.location=href;
                                $(this).attr('href',null);
                            })
                        })
                    </script>
                    <a href='index.php?r=invoices/createQuote&jobnumber=<?= $model->jobid ?>' class='add-button' id='createQuote'>Add Quote</a>
                    
                            
                    <?php 
                    /* @var $model Jobs */
                    $quoteList=$model->quoteList;
                    $salesOrderList=$model->salesOrderList;
                    $invList=$model->invoiceAndCMList;
                    $this->renderPartial('_invoicetable',array(
                        'quoteList'=>$quoteList,
                        'salesOrderList'=>$salesOrderList,
                        'invList'=>$invList,
                        'jobModel'=>$model
                    ));?>
                </div>
                <div id="tabDispatch">
                    <br/>
                    <?php echo CHtml::link(
                            'Add Dispatch',
                            $this->createUrl('/jobs/createDispatch',array('jobid'=>$model->jobid)),
                            array('class'=>'add-button')
                            );?>
                    <div id="dispatch-list"></div>
                </div>
                <div id="tabDocument">
                    <br/>
                    <iframe id="downloadFrame" src="" style="display:none;"></iframe>
                    <a class="add-button" href='javascript:void(0)' id="createJobDocument">Add Document</a>
                    <div id="document-list">

                    </div>
                </div>


            </div><!-- inside -->
        </div><!-- container -->
    </div><!-- wrap -->
<?php $this->renderPartial('/copyright'); ?>
</div> <!-- left-col -->
